package com.qf.dao.impl;

import com.qf.dao.OrderDetailDao;
import com.qf.domain.OrderDetail;
import com.qf.utils.TxUtils;
import org.apache.commons.dbutils.QueryRunner;

import java.sql.Connection;
import java.sql.SQLException;

/**
 * @author YDW
 * projectName:shopping
 * time:2022/4/21 9:55
 * description:
 */
public class OrderDetailDaoImpl implements OrderDetailDao {
    @Override
    public void insert(OrderDetail orderDetail) {
        Connection conn = TxUtils.getConn();
        QueryRunner queryRunner=new QueryRunner();
        String sql=" insert into tb_orderdetail (id,Oid,pid,num,Money) values(null,?,?,?,?)";
        try {
            queryRunner.update(conn,sql,orderDetail.getOid(),orderDetail.getPid(),orderDetail.getNum(),orderDetail.getMoney());
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
}
